package com.alogic.matcher.impl;

import com.alogic.matcher.CommonMatcher;
import com.anysoft.util.Properties;
import com.anysoft.util.PropertiesConstants;


/**
 * 精确匹配
 *
 * @since 1.6.12.57 [20200103]
 */
public class Exact implements CommonMatcher {
    protected String value;
    protected boolean ignoreCase = false;

    public Exact(String regex, Properties p){
        this.value = regex;
        ignoreCase = PropertiesConstants.getBoolean(p,"macher.exact.ignorecase",ignoreCase);
    }

    @Override
    public boolean isMatch(String data) {
        return ignoreCase?value.equalsIgnoreCase(data):value.equals(data);
    }
}
